/*******************************************************************************
*  file    : datascheme.cpp
*  created : 19.08.2013
*  author  : Slyshyk Oleksiy (alexSlyshyk@gmail.com)
*******************************************************************************/

char tbl_devices [] =
        "CREATE TABLE \"devices\" ("
        "    \"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
        "    \"phone_num\" TEXT NOT NULL,"
        "    \"name\" TEXT NOT NULL,"
        "    \"passwd\" TEXT NOT NULL,"
        "    \"memo\" TEXT,"
        "    \"bat_change\" TEXT,"
        "    \"hidden\" INTEGER NOT NULL"
        ");";
char phone_idx [] =
        "CREATE INDEX \"phone_idx\" on devices (phone_num ASC);";
char tbl_incoming [] =
        "CREATE TABLE \"incoming\" ("
        "    \"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
        "    \"text\" TEXT NOT NULL,"
        "    \"source\" TEXT NOT NULL,"
        "    \"date\" TEXT NOT NULL,"
        "    \"task_id\" INTEGER"
        ");";
char tbl_outgoing [] =
        "CREATE TABLE \"outgoing\" ("
        "    \"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
        "    \"text\" TEXT NOT NULL,"
        "    \"recipient\" INTEGER NOT NULL,"
        "    \"date\" TEXT NOT NULL,"
        "    \"state\" INTEGER NOT NULL"
        ");";
char tbl_tasks [] =
        "CREATE TABLE \"tasks\" ("
        "    \"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
        "    \"request\" INTEGER NOT NULL,"
        "    \"answer\" INTEGER,"
        "    \"startdate\" TEXT NOT NULL,"
        "    \"donedate\" TEXT ,"
        "    \"status\" INTEGER NOT NULL"
        ");";

char tbl_version [] =
        "CREATE TABLE \"scheme_version\" ("
        "    \"text\" TEXT NOT NULL"
        ");";
char set_scheme_version [] =
        "INSERT INTO scheme_version (text) VALUES('1.2');";

char add_sleeper_1 [] =
        "INSERT INTO devices "
        "(phone_num, name,passwd, memo, hidden)"
        " VALUES ('+380952680551', 'Sleeper 1', 'adgjmptw', 'Real Sleeper', 0);";
char add_sleeper_2 [] =
        "INSERT INTO devices "
        "(phone_num, name,passwd, memo, hidden)"
        " VALUES ('+380675000851', 'Test 2', 'adgjmptw', 'modem 2', 0);";

